#ifndef WINDOWGAME_H
#define WINDOWGAME_H

#include <QStateMachine>
#include <QFinalState>

#include <QtGui/QWidget>
#include "ui_windowgame.h"

#include "GameBoardModel.h"
#include "TaskStatusDelegate.h"

class WindowGame: public QWidget {
Q_OBJECT
Q_PROPERTY(bool isWaitingForHumanMove READ getWaitingForHumanMove WRITE setWaitingForHumanMove)
Q_PROPERTY(int currentPlayerProperty READ getCurrentPlayerNumber WRITE setCurrentPlayerNumber)

public:
	WindowGame(QWidget *parent = 0);
	~WindowGame();
	void setStateMachine(QState* parentState);
	bool getWaitingForHumanMove() const {
		return waitingForHumanMove;
	}

	void setWaitingForHumanMove(bool waitingForHumanMove) {
		this->waitingForHumanMove = waitingForHumanMove;
	}

	int getCurrentPlayerNumber() const {
		return currentPlayerNumber;
	}

	void setCurrentPlayerNumber(int currentPlayerNumber) {
		this->currentPlayerNumber = currentPlayerNumber;
	}

private:
	Ui::WindowGameClass ui;
	GameBoardModel *model;
	bool waitingForHumanMove;
	int currentPlayerNumber;
	QState *stateStart, *statePlayer1, *stateCheck, *statePlayer2;
	QFinalState *finalState;

private slots:
	void cellClicked(QModelIndex index);
	void playerMove();

signals:
	void gameStarted();
	void gameFinished();

	void moveMade();
};

#endif // WINDOWGAME_H
